#!/bin/bash
counter=0
alphabet=`echo {A..Z}`
buffer=(${alphabet// / })
buffsize=${#buffer[@]}
while (( $counter<=$buffsize ))
do
	#wait(space)
	bash wait.sh space.txt
  	#wait(free)
	bash wait.sh free.txt
	if (( $counter<$buffsize ))
	then
  	echo "${buffer[$counter]}" >> buffer.txt
	echo "produce a ${buffer[$counter]}"
	fi
	let "counter++"
  	#signal(free)
	bash signal.sh free.txt
  	#signal(data)
	bash signal.sh data.txt
done
echo "Production Completed!"
exit
